﻿using System.Xml;
using System.Xml.XPath;
using FeedsLibrary.Feeds.Abstract;

namespace FeedsLibrary.Feeds.RDF
{
    internal class RDFItem : AbstractItem
    {
        public RDFItem(string domain, IXPathNavigable nodeItem)
        {
            LoadStandardAttributes(domain, nodeItem);
            FeedSpecificAttributes(nodeItem);
        }

        public override void FeedSpecificAttributes(IXPathNavigable nodeItem2)
        {
            XmlNode nodeItem = nodeItem2 as XmlNode;
            if (nodeItem["description"] != null)
            {
                Description = nodeItem["description"].InnerText;
            }

            if (nodeItem["dc:date"] != null)
            {
                string strDate = nodeItem["dc:date"].InnerText;
                PubDate = GetDate(strDate);
            }
            else
            {
                PubDate = _lastBuildDate;
            }
        }
    }
}